
package br.unesp.demac.bcc.soo.clarus.ws;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;


/**
 * <p>Java class for obra complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="obra">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="anoPublicacao" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         &lt;element name="autor" type="{http://ws.clarus.soo.bcc.demac.unesp.br/}autor" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="coverUrl" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="dataInclusao" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *         &lt;element name="editora" type="{http://ws.clarus.soo.bcc.demac.unesp.br/}editora" minOccurs="0"/>
 *         &lt;element name="emprestimo" type="{http://ws.clarus.soo.bcc.demac.unesp.br/}emprestimo" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="flagExcluido" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="idObra" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         &lt;element name="localizacao" type="{http://ws.clarus.soo.bcc.demac.unesp.br/}localizacao" minOccurs="0"/>
 *         &lt;element name="nomeObra" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "obra", propOrder = {
    "anoPublicacao",
    "autor",
    "coverUrl",
    "dataInclusao",
    "editora",
    "emprestimo",
    "flagExcluido",
    "idObra",
    "localizacao",
    "nomeObra"
})
public class Obra {

    protected int anoPublicacao;
    @XmlElement(nillable = true)
    protected List<Autor> autor;
    protected String coverUrl;
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar dataInclusao;
    protected Editora editora;
    @XmlElement(nillable = true)
    protected List<Emprestimo> emprestimo;
    protected boolean flagExcluido;
    protected int idObra;
    protected Localizacao localizacao;
    protected String nomeObra;

    /**
     * Gets the value of the anoPublicacao property.
     * 
     */
    public int getAnoPublicacao() {
        return anoPublicacao;
    }

    /**
     * Sets the value of the anoPublicacao property.
     * 
     */
    public void setAnoPublicacao(int value) {
        this.anoPublicacao = value;
    }

    /**
     * Gets the value of the autor property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the autor property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getAutor().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Autor }
     * 
     * 
     */
    public List<Autor> getAutor() {
        if (autor == null) {
            autor = new ArrayList<Autor>();
        }
        return this.autor;
    }

    /**
     * Gets the value of the coverUrl property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCoverUrl() {
        return coverUrl;
    }

    /**
     * Sets the value of the coverUrl property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCoverUrl(String value) {
        this.coverUrl = value;
    }

    /**
     * Gets the value of the dataInclusao property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getDataInclusao() {
        return dataInclusao;
    }

    /**
     * Sets the value of the dataInclusao property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setDataInclusao(XMLGregorianCalendar value) {
        this.dataInclusao = value;
    }

    /**
     * Gets the value of the editora property.
     * 
     * @return
     *     possible object is
     *     {@link Editora }
     *     
     */
    public Editora getEditora() {
        return editora;
    }

    /**
     * Sets the value of the editora property.
     * 
     * @param value
     *     allowed object is
     *     {@link Editora }
     *     
     */
    public void setEditora(Editora value) {
        this.editora = value;
    }

    /**
     * Gets the value of the emprestimo property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the emprestimo property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getEmprestimo().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Emprestimo }
     * 
     * 
     */
    public List<Emprestimo> getEmprestimo() {
        if (emprestimo == null) {
            emprestimo = new ArrayList<Emprestimo>();
        }
        return this.emprestimo;
    }

    /**
     * Gets the value of the flagExcluido property.
     * 
     */
    public boolean isFlagExcluido() {
        return flagExcluido;
    }

    /**
     * Sets the value of the flagExcluido property.
     * 
     */
    public void setFlagExcluido(boolean value) {
        this.flagExcluido = value;
    }

    /**
     * Gets the value of the idObra property.
     * 
     */
    public int getIdObra() {
        return idObra;
    }

    /**
     * Sets the value of the idObra property.
     * 
     */
    public void setIdObra(int value) {
        this.idObra = value;
    }

    /**
     * Gets the value of the localizacao property.
     * 
     * @return
     *     possible object is
     *     {@link Localizacao }
     *     
     */
    public Localizacao getLocalizacao() {
        return localizacao;
    }

    /**
     * Sets the value of the localizacao property.
     * 
     * @param value
     *     allowed object is
     *     {@link Localizacao }
     *     
     */
    public void setLocalizacao(Localizacao value) {
        this.localizacao = value;
    }

    /**
     * Gets the value of the nomeObra property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getNomeObra() {
        return nomeObra;
    }

    /**
     * Sets the value of the nomeObra property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setNomeObra(String value) {
        this.nomeObra = value;
    }

    public String autoresToString() {
        String autores = "";
        for (Autor a : this.autor) {
            autores += a.getNomeAutor() + ", ";
        }
        autores = autores.substring(0, autores.length() - 2);
        return autores;
    }
}
